module Kuztuscms
  class Setting < ActiveRecord::Base
    validates :value, :presence => true
    validates :key, :uniqueness => true, 
                    :format => { :with => /\A[a-z0-9_-]+\z/, :message => "Only lowercase letters, numbers and dashes allowed"},
                    :presence => true
    after_save do
      Kuztuscms::Settings.clear_cache
    end
  end
end
